package ua.cn.store.domain;


import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.sun.istack.internal.NotNull;


//@Embeddable
@NamedQueries({
	//@NamedQuery(name="Account.getAccountByUser",query="select a from Account a where a.user.id=?1"),
	//@NamedQuery(name="DeleteByUser",query="delete from Account a where a.user.id=?1")
})
public class Account extends Domain {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String login;
	private String passwd;
		
	
	public boolean enter(String log, String pass){
		if ((this.login==log)&&(this.passwd==pass))
			return true;
		return false;
	}
	
	public void register(String log, String pass, String email){
		//this.setEmail(email);
		this.setPasswd(pass);
		this.setLogin(log);	
	}

	@Column(name="login")
	@NotNull
	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}
	
	@NotNull
	@Column(name="passwd")
	public String getPasswd() {
		return passwd;
	}

	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}
	
  /*  @OneToOne
    @JoinColumn(name="u_id")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}*/
}
